import { RouteRecordRaw } from "vue-router";
import HomeView from "@/views/ExampleViem.vue";
import accessEnum from "@/access/accessEnum";

export const routes: Array<RouteRecordRaw> = [
  {
    path: "/user",
    name: "用户布局",
    component: import("@/layouts/UserLayout.vue"),
    meta: {
      hideInMenu: true
    },
    children: [
      {
        path: "/user/login",
        name: "用户登录",
        component: import("@/views/user/UserLoginView.vue")
      },
      {
        path: "/user/register",
        name: "用户注册",
        component: import("@/views/user/UserRegisterView.vue")
      }
    ]
  },
  {
    path: "/",
    name: "主页",
    component: HomeView
  },
  {
    path: "/search/question",
    name: "浏览题目",
    component: import("@/views/question/SearchQuestion.vue")
  },
  {
    path: "/add/question",
    name: "创建题目",
    component: import("@/views/question/AddQuestionView.vue"),
    meta: {
      access: accessEnum.USER
    }
  },
  {
    path: "/manage/question",
    name: "管理题目",
    component: import("@/views/question/ManageQuestion.vue"),
    meta: {
      access: accessEnum.ADMIN
    }
  },
  {
    path: "/update/question",
    name: "更新题目",
    component: import("@/views/question/AddQuestionView.vue"),
    meta: {
      access: accessEnum.USER,
      hideInMenu: true
    }
  },
  {
    path: "/noAuth",
    name: "无权限",
    component: import("@/views/NoAuthView.vue"),
    meta: {
      hideInMenu: true
    }
  }
];
